package com.star.rpc.spi;

import com.star.rpc.serializer.JdkSerializer;
import com.star.rpc.serializer.Serializer;

/**
 * packageName com.star.rpc.spi
 *
 * @author zerostart
 * @className SerializerFactory
 * @date 2024/11/20
 * @description 序列化器工程
 */

public class SerializerFactory {
    static {
        System.out.println("执行开始");
        SpiLoader.load(Serializer.class);
        System.out.println("执行结束");
    }
    /**
     * 默认序列化器
     */
    private static final Serializer DEFAULT_SERIALIZER = new JdkSerializer();


    /**
     * 获取实例
     *
     * @param key
     * @return
     */
    public static Serializer getInstance(String key) {
        return SpiLoader.getInstance(Serializer.class, key);
    }
}
